﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CaltechSoft.Service.Infrastructure
{
    public class CacheStrategy : ICacheStrategy
    {
        public static readonly ICacheStrategy Instance = new CacheStrategy();
        private readonly ICacheStrategy _cacheStrategy;

        private CacheStrategy()
        {
            _cacheStrategy = new WebCacheStrategy();
        }

        public object Get(string key)
        {
            return _cacheStrategy.Get(key);
        }

        public void Insert(string key, object obj, int seconds)
        {
            _cacheStrategy.Insert(key, obj, seconds);
        }

        public void Max(string key, object obj)
        {
            _cacheStrategy.Max(key, obj);
        }

        public T Get<T>(string cacheKey, int seconds, Func<T> func)
        {
            return _cacheStrategy.Get(cacheKey, seconds, func);
        }

        public void Remove(string key)
        {
            _cacheStrategy.Remove(key);
        }

        public void Clear()
        {
            _cacheStrategy.Clear();
        }
    }
}
